#ifndef _CONTROLLER_H_
#define _CONTROLLER_H_

// command types
#define TR    0
#define SW    1
#define RV    2
#define WH    3
#define GO    4
#define STOP  5

// command constants
#define TRAIN_SOLENOID_OFF  0x20
#define TRAIN_SW_STRAIGHT   0x21
#define TRAIN_SW_CURVED     0x22
#define TRAIN_REVERSE       0x0f
#define TRAIN_GO            0x60
#define TRAIN_STOP          0x61
#define TRAIN_SENSORS_BASE  0x80
#define TRAIN_SENSOR_BASE   0xc0

// other train set constants
#define NUM_SENSOR_MODULES  5

/* STATUS-TRACKING STRUCTS */

typedef struct __event {
  int ii;
  char cc[10];
} event;

typedef struct __command {
  int type;
  int arg0;
  int arg1;
} command;

void Tr(int train_number, int train_speed);
void Rv(int train_number);
// void FlipSwitch(track *sts, int switch_number, char switch_direction);
void Sw(int switch_number, char switch_direction);
void Wh();
void Stop();
void Go();

#endif // _CONTROLLER_H_
